const Promise = require('bluebird');

/**
 * @api {get} /api/admin/v1/categories/tree 商品分类树
 * @apiGroup AdminGoodses
 * @apiDescription 商品管理-商品分类树
 * @apiPermission 管理员(查看商品权限)
 * @apiVersion 1.0.0
 */
exports.tree = function ({}, {modelsData:{Categories}, models: {}}) {
    return Categories.treeV2().then(function (tree) {
        return [{
            id: 'all',
            text: '最上层',
            children: tree
        }];
    });
}

